package yongjian.drp.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import yongjian.drp.dao.UserDao;
import yongjian.drp.model.User;

@Component
public class UserService {

	private UserDao userDao;

	public UserDao getUserDao() {
		return userDao;
	}
	@Resource
	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}

	public List<User> exist(User u) {
		return userDao.exist(u);
	}

	public void add(User u) {
		userDao.add(u);
	}

	public void modify(User u) {
		userDao.modify(u);
	}
	
	public String modifyPw(User u,String oldPassword) {
		return userDao.modifyPw(u,oldPassword);
	}

	public void delete(int id) {
		userDao.delete(id);
	}

	public List<User> queryByPage(int page, int rows,String key) {
		return userDao.queryByPage(page, rows, key);
	}

	public int getAllUserRecord(String key) {
		return userDao.getAllUserRecord(key);
	}
	
	public void pwReset(String username) {
		userDao.modifyPw(username);		
	}
}
